1. Mailmerge from Access
If you are tired of
typing letter after letter out to your clients when all their details are in
your Access database, check out this SSW web page which shows you how to do a
mail merge from Access. Lavishly illustrated with screenshots, it is a guide
even a beginner can follow!
https://www.ssw.com.au/ssw/Standards/DeveloperAccess/HowToDoMailMergeInWordUsingAccessData.aspx
2. Execute two select
statements as one in ADO
Your can execute two
select statements as one. Using this feature you can then execute a SQL
statement with multiple return recordsets using one recordset object. The
following code shows you how to use two recordsets with one recordset object.
To do this you have to use the NEXTRECORDSET method of the recordset Object.
dim cmd
dim conn
dim rst
dim strSql
dim strCustID
'---For this Demo, get CustID---
strCustID="ALFKI"
set conn= server.CreateObject("Adodb.connection")
set cmd = server.CreateObject("Adodb.command")
'---Set Connection---
with conn
.ConnectionString="Provider=SQLOLEDB.1;Persist Security Info=False;User
ID=sa;Initial Catalog=Northwind;Data Source=ALPACA"
.Open
end with
'---2 select statements----
strSql="select * from Customers Where CustomerID " & strCustID
strSql= strSql & vbNewLine
strSql=strSql & "Select * from Orders Where CustomerID " & strCustID
with cmd
.CommandText=strSql
.ActiveConnection=conn
end with
set rst=cmd.Execute
'---first recordset---
do until rst.eof
Response.Write rst("companyname") &"<br>"
rst.movenext
loop
'---second recordset---
Response.Write "======Order Date======"
set rst=rst.nextRecordset
do until rst.eof
Response.Write rst("OrderDate") &"<br>
rst.movenext
loop
conn.close
set rst=nothing
set cmd=nothing
set cmd=nothing set conn=nothing
Copy and Paste in Command
Window
When working in a
Command Window, you can use the mouse to highlight a block of text to copy once
highlighted, pressing Enter will copy the text to the clipboard. To paste the
text (or any text from the clipboard) back into the Command Window, click the
right mouse button on the Command Window.
Got a hot tip you want
to share? Tip
|